home *** CD-ROM | disk | FTP | other *** search
- on mouseDown
- set xCenter to ((the left of sprite 4 + the right of sprite 4) / 2) + 2
- set yCenter to ((the top of sprite 4 + the bottom of sprite 4) / 2) + 2
- set radius to the width of sprite 4 / 2
- puppetSprite(the clickOn, 1)
- puppetSprite(5, 1)
- repeat while the stillDown
- set mx to the mouseH
- set my to the mouseV
- set xAtMouse to mx - xCenter
- set yAtMouse to my - yCenter
- if xAtMouse <> 0 then
- set angleAtMouse to atan(float(abs(yAtMouse)) / float(abs(xAtMouse)))
- if angleAtMouse = 0 then
- set yAtCircle to 0
- set xAtCircle to radius * (xAtMouse / abs(xAtMouse))
- else
- set yAtCircle to sin(angleAtMouse) * float(radius) * (yAtMouse / abs(yAtMouse))
- set xAtCircle to cos(angleAtMouse) * float(radius) * (xAtMouse / abs(xAtMouse))
- end if
- else
- set xAtCircle to 0
- if yAtMouse <> 0 then
- set yAtCircle to radius * (yAtMouse / abs(yAtMouse))
- else
- set yAtCircle to radius
- end if
- end if
- set the locH of sprite the clickOn to xCenter + xAtCircle
- set the locV of sprite the clickOn to yCenter + yAtCircle
- drawLine(6, yCenter, xCenter, the locV of sprite the clickOn, the locH of sprite the clickOn)
- set the locH of sprite 5 to ((the left of sprite 6 + the right of sprite 6) / 2) + 10
- set the locV of sprite 5 to ((the top of sprite 6 + the bottom of sprite 6) / 2) - 20
- updateStage()
- end repeat
- end
-